
function initValidator(){
	
		jQuery.validator.addMethod("stringCheck", function(value, element) {
			var flag=false;
			var reg0=/^[A-Za-z0-9\(\)\~!@#\$\%\^\&\*_<>]+$/.test(value);
		    var reg1=/[A-Za-z]/.test(value);
		    var reg2=/[0-9]/.test(value);
		    var reg3=/[\(\)\~!@#\$\%\^\&\*_<>]/.test(value);
			if(reg0){
			  if(reg1&&reg2)flag=true;
			  if(reg2&&reg3)flag=true;
			  if(reg1&&reg3)flag=true;
			}
             return this.optional(element) || flag;
           }, "长度至少为8位,密码必须从字符（a-z，A-Z）、数字（0-9）、符号（~！@#$%^&*()_<>）中至少选择两种进行组合");

		jQuery.validator.addMethod("phoneCheck", function(value, element) {
			var flag=false;
			var reg=/\d{3}-\d{8}|\d{4}-\d{7}/.test(value);
			if(reg){
				flag = true;
			}
             return this.optional(element) || flag;
           }, "必须填写合法的电话号码");
		jQuery.validator.addMethod("mobileCheck", function(value, element) {
			var flag=false;
			var reg=/^(13[0-9]|15[0|3|6|7|8|9]|18[8|9])\d{8}$/.test(value);
			if(reg){
				flag = true;
			}
             return this.optional(element) || flag;
           }, "必须填写合法的手机号码");
		jQuery.validator.addMethod("mailCheck", function(value, element) {
			var flag=false;
			var reg=/\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/.test(value);
			if(reg){
				flag = true;
			}
             return this.optional(element) || flag;
           }, "必须填写合法的邮箱地址");

		var container = $('div.container');
		var validator = $("#form1").validate({
			submitHandler: function(form) {
				submitData();
			},
			errorContainer: container,
			errorLabelContainer: $("ol", container),
			wrapper: 'li',
			meta: "validate",
			rules: {
			     "user.userName":{
			      required: true, 
			      maxlength:20
			     },
			     "user.loginName":{
			      required: true, 
			      maxlength:20 , 
			      remote: {
				      	/*url: baserUrl+'/user/check?tdqssid='+TDQS.SESSION_ID,*/
				      	url: baserUrl+'/user/check',
				      	type: 'post',
				      	data: {
				      		id : function() {
				      			return $('#userId').val();
				      		}
				      	}
				  }
			     }, 
			     "user.password":{
			      required: false, 
				  stringCheck: true,
				  minlength:8,
			      maxlength:50
			     },
			     "password":{
			      required: false, 
			      maxlength:50 , 
			      equalTo:"#password"
			     },
			     "user.department.company.name":{
			      required: false
			     },
			     "user.department.name":{
				      required: false
				     },

			     "user.roleNames":{
			      required: false
			     },
			     "user.post.postId":{
			    	 required: true
			     },
			     "user.phone":{
			    	  phoneCheck: true,
				      maxlength:50
				     },
			     "user.mobile":{
				      mobileCheck: true,
				      maxlength:50
				     },
			     "user.email":{
				      mailCheck: true,
				      maxlength:100
				     }
				 ,
			     "user.loginTypes":{
			      required: false
			     }
		    },
		    
		    messages:{
		    	"user.userName":{
		    		required: "姓名是必需的",
		    		maxlength: "姓名最大不能超过20个字符"
		    	},
		    	"user.loginName":{
		    		required: "用户名是必需的",
		    		remote: jQuery.format("当前用户名已存在，请更换其他用户名"),
		    		maxlength: "用户名最大不能超过20个字符"
		    	},
		    	"user.password":{
		    		required: "密码是必需的",
					stringCheck: "长度至少为8位，密码必须从字符（a-z，A-Z）、数字（0-9）、符号（~！@#$%^&*()_<>）中至少选择两种进行组合",
					minlength:"密码至少8位",
		    		maxlength: "密码最大不能超过50个字符"
		    	},
		    	"password":{
		    		required: "确认密码是必需的",
		    		equalTo:"确认密码必须与新密码相同",
		    		maxlength: "确认密码最大不能超过50个字符"
		    	},
		    	"user.department.company.name":{
		    		required: "所属单位是必需的"
		    	},
		    	"user.department.name":{
		    		required: "所属部门是必需的"
		    	},
		    	"user.roleNames":{
		    		required: "角色是必需的"
		    	},
		    	"user.post.postId":{
			    	 required: "职位是必需的"
				},
		    	"user.phone":{
					  phoneCheck: "必须填写合法的电话号码",
				      maxlength:"座机最大不能超过50个字符"
				     },
			     "user.mobile":{
				      mobileCheck: "必须填写合法的手机号码",
				      maxlength:"手机最大不能超过50个字符"
				     },
			     "user.email":{
				      mailCheck: "必须填写合法的邮箱地址",
				      maxlength:"邮箱最大不能超过100个字符"
				     }
		    	,
		    	"user.loginTypes":{
		    		required: "登录类型是必需的"
		    	}
		    
		    }
			
		});
}
function contentLayout(){
	
	$(".tempDiv").css("height",window.document.body.clientHeight-28);
	$(".content_c").css("height",window.document.body.clientHeight-$(".serverErrorContainer").height()-28);
	if($.browser.msie&&($.browser.version == "6.0")){
		$(".content_c").css("width",window.document.body.clientWidth-5);
	}
	$(".serverErrorContainer").css("width",window.document.body.clientWidth);
}